<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>门店管理</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.js"></script>
	</head>

	<body>
		<form class="update_form layui-form" action="">
			<div class="layui-form-item">
				<label class="layui-form-label">门店名称</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="store_name" required lay-verify="required" placeholder="门店名称" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">门店地址</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="addres" required lay-verify="required" placeholder="门店地址" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item update_btnbox">
				<div class="layui-input-block">
					<button class="layui-btn"  lay-submit lay-filter="submit_from">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</body>

</html>
<script type="text/javascript">
	layui.use('form', function() {
		var form = layui.form;
		//监听表单提交
		form.on('submit(submit_from)', function(data){
			tijiao();
  			return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
		});
	});
	//提交表单
	function tijiao() {
		$.ajax({
			type: "post",
			url: "{:url('store/store_add')}",
			data: $('.update_form').serialize(), //表单数据
			success: function(data) {
				if(data.code == 200) {
					layer.msg('成功', {
						icon: 1,
						time: 1500 //2秒关闭（如果不配置，默认是3秒）
					}, function() {
						window.parent.location.reload();
						var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
						parent.layer.close(index);
					});
				} else {
					layer.msg('失败！'); //保存成功提示
				}
			},
			error: function(data) {
				var a = data;
			}
		});

	}
</script>